﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CROSLAND.DL.DALC;

namespace CROSLAND.DL.DALCF
{
    public enum ConnectionType { SQLServer, Oracle, SAP, NC03 }

    public class DaoFactory
    {
        public static ConnectionType ConnType = ConnectionType.SAP;
        public static ConnectionType ConnTypeUsuarios = ConnectionType.SAP;
        public static string pConnId = string.Empty;


        public static IUsuarioDALC UsuarioDALC
        {
            get
            {
                IUsuarioDALC objRet = null;
                switch (ConnTypeUsuarios)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.UsuarioDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.UsuarioDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.UsuarioDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }
        public static IUsuarioSAPDALC UsuarioSAPDALC
        {
            get
            {
                return new CROSLAND.DL.DALC.MSSQL.UsuarioSAPDALC();
            }
        }
        public static ISistemaSAPDALC SistemaSAPDALC
        {
            get
            {
                return new CROSLAND.DL.DALC.MSSQL.SistemaSAPDALC();
            }
        }

        public static ICondicionDALC CondicionDALC
        {
            get
            {
                ICondicionDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.CondicionDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.CondicionDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.CondicionDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IPedidoDALC PedidoDALC
        {
            get
            {
                IPedidoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.PedidoDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.PedidoDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.PedidoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IJerarquiaDALC JerarquiaDALC
        {
            get
            {
                IJerarquiaDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.JerarquiaDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.JerarquiaDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.JerarquiaDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IStockDALC StockDALC
        {
            get
            {
                IStockDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.StockDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.StockDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.StockDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IClienteDALC ClienteDALC
        {
            get
            {
                IClienteDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.ClienteDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.ClienteDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.ClienteDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IMaterialDALC MaterialDALC
        {
            get
            {
                IMaterialDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.MaterialDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.MaterialDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.MaterialDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IParametroDALC ParametroDALC
        {
            get
            {
                IParametroDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.ParametroDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.ParametroDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.ParametroDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IUbigeoDALC UbigeoDALC
        {
            get
            {
                IUbigeoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        //objRet = new DECOR.DL.DALC.MSSQL.ParametroDALC();
                        break;
                    case ConnectionType.SAP:
                        //Ubigeo solo creado para NCO3
                        //objRet = DECOR.DL.DALC.SAPC.IUbigeoDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.UbigeoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IImpresionDALC ImpresionDALC
        {
            get
            {
                IImpresionDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = new CROSLAND.DL.DALC.MSSQL.ImpresionDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.ImpresionDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.UbigeoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static ICierreDALC CierreDALC
        {
            get
            {
                ICierreDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        objRet = CROSLAND.DL.DALC.MSSQL.CierreDALC.Instance();
                        break;
                    case ConnectionType.SAP:
                        objRet = CROSLAND.DL.DALC.SAPC.CierreDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        //objRet = CROSLAND.DL.DALC.NC03.UbigeoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }
    }
}
